﻿using System;


namespace InteractiveFiction.Model
{
    public class Utils
    {
        public static string Article(string noun, bool definite, bool capitol)
        {
            if (definite)
            {
                if (capitol)
                    return "The " + noun;
                else
                    return " the " + noun;
            }

            char[] nounLetters = noun.Trim().ToLower().ToCharArray();
            if (nounLetters[0] == 'a' || nounLetters[0] == 'e' || nounLetters[0] == 'i' || nounLetters[0] == 'o' || nounLetters[0] == 'u' || nounLetters[0] == 'y')
            {
                if(capitol)
                    return "An " + noun;
                else
                    return " an " + noun;
            }
            else
            {
                if (capitol)
                    return "A " + noun;
                else
                    return " a " + noun;
            }
        }

        /// <summary>
        /// Conjugates the verb "to have" based on whether the subject is the player or not.
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="isPlayer"></param>
        /// <returns></returns>
        public static string ConjugateHave(Character subject, bool isPlayer) 
        {
            if (isPlayer)
                return "You have ";
            else
                return subject.Name + " has ";
        }
    }
}
